#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

class Solution
{
public:
    void isUgly()
    {
        map<string, int> dic{{"0706", 0}, {"0703", 0}, {"0710", 0}, {"0711", 0}, {"other", 0}};
        int n;
        string s_num;
        cin >> n;
        for (size_t i = 0; i < n; i++)
        {
            cin >> s_num;
            s_num = s_num.substr(4, 4); // 切割字符串，从索引位置4开始之后往后数4个位置的字符串
            if (s_num == "0706")
            {
                dic["0706"] += 1;
            }
            else if (s_num == "0703")
            {
                dic["0703"] += 1;
            }
            else if (s_num == "0710")
            {
                dic["0710"] += 1;
            }
            else if (s_num == "0711")
            {
                dic["0711"] += 1;
            }
            else
            {
                dic["other"] += 1;
            }
        }
        for (auto c : dic)
        {
            cout << c.second << " ";
        }
    }
};

int main()
{
    Solution test;
    test.isUgly();
    return 0;
}